<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>游戏商店 - 首页</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css"/>
    <script src="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.js"></script>

    <!-- Tailwind CSS 配置 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#165DFF',
                        secondary: '#36CFC9',
                        accent: '#722ED1',
                        dark: '#1D2129',
                        light: '#F2F3F5'
                    },
                    fontFamily: {
                        inter: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>

    <!-- 自定义工具类 -->
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .navbar-shadow {
                box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            }
            .hover-scale {
                transition: transform 0.2s ease;
            }
            .hover-scale:hover {
                transform: scale(1.05);
            }
        }
    </style>
</head>
<body class="font-inter bg-gray-50 text-dark">
<!-- 导航栏 -->
<header class="fixed top-0 left-0 right-0 z-50 bg-white navbar-shadow transition-all duration-300">
    <div class="container mx-auto px-4">
        <div class="flex items-center justify-between h-16 md:h-20">
            <!-- Logo -->
            <a href="/home" class="flex items-center space-x-2">
                <div class="w-10 h-10 rounded-lg bg-primary flex items-center justify-center">
                    <i class="fa fa-gamepad text-white text-xl"></i>
                </div>
                <span class="text-xl font-bold text-dark">GameStore</span>
            </a>

            <!-- 主导航 - 桌面版 -->
            <nav class="hidden md:flex items-center space-x-8">
                <a href="/home" class="text-primary font-medium">首页</a>
                <a href="/gamelist" class="text-dark hover:text-primary transition-colors">所有游戏</a>
                <a href="#" class="text-dark hover:text-primary transition-colors">新上架</a>
            </nav>

            <!-- 搜索框 -->
            <div class="hidden md:flex items-center flex-1 max-w-md mx-8">
                <form action="/search" method="get">
                    <div class="relative w-full">
                        <input type="text" name="key" placeholder="搜索游戏..." class="w-full pl-10 pr-4 py-2 rounded-full bg-gray-100 focus:outline-none focus:ring-2 focus:ring-primary/30 transition-all">
                        <button type="submit" class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </form>
            </div>

            <!-- 右侧操作区 -->
            <div class="flex items-center space-x-4">
                <!-- 购物车 -->
                <a href="/shoppingcart" class="relative p-2 rounded-full hover:bg-gray-100 transition-colors">
                    <i class="fa fa-shopping-cart text-lg"></i>
                    <span class="absolute -top-1 -right-1 w-4 h-4 rounded-full bg-primary text-white text-xs flex items-center justify-center">3</span>
                </a>

                <!-- 个人中心菜单 -->
                <div class="relative group">
                    <button class="flex items-center space-x-1 focus:outline-none">
                        <i class="fa fa-user-circle text-xl"></i>
                        <span class="hidden md:inline-block font-medium">个人中心</span>
                        <i class="fa fa-angle-down text-gray-500"></i>
                    </button>

                    <!-- 下拉菜单 -->
                    <div class="absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg py-2 z-10 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-300 transform origin-top-right group-hover:scale-100 scale-95">
                        <a href="/orderlist" class="block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors">
                            <i class="fa fa-list-alt mr-2"></i>我的订单
                        </a>
                        <a href="/setting" class="block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors">
                            <i class="fa fa-cog mr-2"></i>设置
                        </a>
                        <div class="border-t border-gray-100 my-1"></div>
                        <a href="/logout" class="block px-4 py-2 text-red-600 hover:bg-gray-100 transition-colors">
                            <i class="fa fa-sign-out mr-2"></i>退出登录
                        </a>
                    </div>
                </div>

                <!-- 移动端菜单按钮 -->
                <button class="md:hidden p-2 rounded-lg hover:bg-gray-100 transition-colors" id="mobile-menu-button">
                    <i class="fa fa-bars text-xl"></i>
                </button>
            </div>
        </div>

        <!-- 移动端导航菜单 -->
        <div class="md:hidden hidden" id="mobile-menu">
            <div class="pt-2 pb-4 space-y-1">
                <a href="/home" class="block px-3 py-2 rounded-md text-base font-medium text-primary bg-primary/10">首页</a>
                <a href="/gamelist" class="block px-3 py-2 rounded-md text-base font-medium text-dark hover:bg-gray-100">游戏分类</a>
                <a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-dark hover:bg-gray-100">新上架</a>

                <!-- 移动端搜索框 -->
                <div class="px-3 py-2">
                    <!-- home页面搜索表单部分 -->
                    <form action="/search" method="get" th:action="@{/search}">
                        <div class="relative w-full">
                            <input type="text" name="key" placeholder="搜索游戏..."
                                   class="w-full pl-10 pr-4 py-2 rounded-full bg-gray-100 focus:outline-none focus:ring-2 focus:ring-primary/30 transition-all"
                                   th:value="${session.searchKey}"> <!-- 保留上次搜索词 -->
                            <i class="fa fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                        </div>
                    </form>
                </div>

                <div class="border-t border-gray-100 my-2"></div>

                <a href="/orderlist" class="block px-3 py-2 rounded-md text-base font-medium text-dark hover:bg-gray-100">
                    <i class="fa fa-list-alt mr-2"></i>我的订单
                </a>
                <a href="/settings" class="block px-3 py-2 rounded-md text-base font-medium text-dark hover:bg-gray-100">
                    <i class="fa fa-cog mr-2"></i>设置
                </a>
                <div class="border-t border-gray-100 my-2"></div>
                <a href="/logout" class="block px-3 py-2 rounded-md text-base font-medium text-red-600 hover:bg-gray-100">
                    <i class="fa fa-sign-out mr-2"></i>退出登录
                </a>
            </div>
        </div>
    </div>
</header>

<!-- 页面内容占位符 -->
<main class="pt-24 pb-12 px-4">
    <!-- 轮播图 -->
    <div class="swiper mySwiper">
        <div class="swiper-wrapper">
            <!-- 轮播图项 1 -->
            <div class="swiper-slide">
                <a href="10.html">
                    <img src="delta.jpg" alt="三角洲行动游戏封面">
                </a>
            </div>
            <!-- 轮播图项 2 -->
            <div class="swiper-slide">
                <a href="11.html">
                    <img src="nba.jpg" alt="NBA2K25游戏封面">
                </a>
            </div>
            <!-- 轮播图项 3 -->
            <div class="swiper-slide">
                <a href="13.html">
                    <img src="cyberpunk.jpg" alt="赛博朋克2077游戏封面">
                </a>
            </div>
            <!-- 轮播图项 4 -->
            <div class="swiper-slide">
                <a href="9.html">
                    <img src="wukong.jpg" alt="黑神话悟空游戏封面">
                </a>
            </div>
            <!-- 可以添加更多轮播图项 -->
        </div>
        <div class="swiper-pagination"></div>
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>
    <div class="container mx-auto">
        <h1 class="text-[clamp(1.5rem,3vw,2.5rem)] font-bold text-dark mb-6">欢迎来到 GameStore</h1>
        <p class="text-gray-600 mb-8">发现最新、最热门的游戏，开启你的游戏之旅</p>

        <!-- 这里是页面内容，根据需要填充 -->
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
            <!-- 艾尔登法环游戏卡片 -->
            <a href="15.html" class="group">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale transition-all duration-300 hover:shadow-lg">
                    <img src="eilden.jpg" alt="艾尔登法环游戏封面" class="w-full h-48 object-cover transition-transform duration-500 group-hover:scale-105">
                    <div class="p-4">
                        <h3 class="font-bold text-lg mb-2 group-hover:text-primary transition-colors">艾尔登法环</h3>
                        <p class="text-gray-600 text-sm mb-4">这是一款令人惊叹的游戏，具有出色的图形和引人入胜的故事情节。</p>
                        <div class="flex justify-between items-center">
                            <span class="font-bold text-primary">¥99.00</span>
                            <button class="px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors">
                                <i class="fa fa-shopping-cart mr-1"></i> 加入购物车
                            </button>
                        </div>
                    </div>
                </div>
            </a>

            <!-- 地平线5游戏卡片 -->
            <a href="20.html" class="group">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale transition-all duration-300 hover:shadow-lg">
                    <img src="horizon.jpg" alt="地平线5游戏封面" class="w-full h-48 object-cover transition-transform duration-500 group-hover:scale-105">
                    <div class="p-4">
                        <h3 class="font-bold text-lg mb-2 group-hover:text-primary transition-colors">地平线5</h3>
                        <p class="text-gray-600 text-sm mb-4">这是一款令人惊叹的游戏，具有出色的图形和引人入胜的故事情节。</p>
                        <div class="flex justify-between items-center">
                            <span class="font-bold text-primary">¥129.00</span>
                            <button class="px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors">
                                <i class="fa fa-shopping-cart mr-1"></i> 加入购物车
                            </button>
                        </div>
                    </div>
                </div>
            </a>

            <!-- 三角洲行动游戏卡片 -->
            <a href="10.html" class="group">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale transition-all duration-300 hover:shadow-lg">
                    <img src="delta.jpg" alt="三角洲行动游戏封面" class="w-full h-48 object-cover transition-transform duration-500 group-hover:scale-105">
                    <div class="p-4">
                        <h3 class="font-bold text-lg mb-2 group-hover:text-primary transition-colors">三角洲行动</h3>
                        <p class="text-gray-600 text-sm mb-4">这是一款令人惊叹的游戏，具有出色的图形和引人入胜的故事情节。</p>
                        <div class="flex justify-between items-center">
                            <span class="font-bold text-primary">免费游玩</span>
                            <button class="px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors">
                                <i class="fa fa-shopping-cart mr-1"></i> 加入购物车
                            </button>
                        </div>
                    </div>
                </div>
            </a>
        </div>

    </div>
</main>

<!-- 页脚 -->
<footer class="bg-dark text-white py-12">
    <div class="container mx-auto px-4">
        <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
            <div>
                <h3 class="text-lg font-bold mb-4">GameStore</h3>
                <p class="text-gray-400">发现最新、最热门的游戏，开启你的游戏之旅。</p>
            </div>
            <div>
                <h3 class="text-lg font-bold mb-4">快速链接</h3>
                <ul class="space-y-2">
                    <li><a href="/home" class="text-gray-400 hover:text-white transition-colors">首页</a></li>
                    <li><a href="/gamelist" class="text-gray-400 hover:text-white transition-colors">游戏分类</a></li>
                    <li><a href="#" class="text-gray-400 hover:text-white transition-colors">新上架</a></li>
                </ul>
            </div>
            <div>
                <h3 class="text-lg font-bold mb-4">支持</h3>
                <ul class="space-y-2">
                    <li><a href="#" class="text-gray-400 hover:text-white transition-colors">帮助中心</a></li>
                    <li><a href="#" class="text-gray-400 hover:text-white transition-colors">联系我们</a></li>
                    <li><a href="#" class="text-gray-400 hover:text-white transition-colors">常见问题</a></li>
                </ul>
            </div>
            <div>
                <h3 class="text-lg font-bold mb-4">关注我们</h3>
                <div class="flex space-x-4">
                    <a href="#" class="w-10 h-10 rounded-full bg-gray-800 flex items-center justify-center hover:bg-primary transition-colors">
                        <i class="fa fa-facebook"></i>
                    </a>
                    <a href="#" class="w-10 h-10 rounded-full bg-gray-800 flex items-center justify-center hover:bg-primary transition-colors">
                        <i class="fa fa-twitter"></i>
                    </a>
                    <a href="#" class="w-10 h-10 rounded-full bg-gray-800 flex items-center justify-center hover:bg-primary transition-colors">
                        <i class="fa fa-instagram"></i>
                    </a>
                </div>
            </div>
        </div>
        <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500">
            <p>&copy; 2025 GameStore. 保留所有权利。</p>
        </div>
    </div>
</footer>

<!-- JavaScript -->
<script>

    // 移动端菜单切换
    document.getElementById('mobile-menu-button').addEventListener('click', function() {
        const mobileMenu = document.getElementById('mobile-menu');
        mobileMenu.classList.toggle('hidden');
    });

    // 导航栏滚动效果
    window.addEventListener('scroll', function() {
        const header = document.querySelector('header');
        if (window.scrollY > 10) {
            header.classList.add('bg-white/95', 'backdrop-blur-sm');
            header.classList.remove('bg-white');
        } else {
            header.classList.remove('bg-white/95', 'backdrop-blur-sm');
            header.classList.add('bg-white');
        }
    });

    // 初始化 Swiper
    var swiper = new Swiper(".mySwiper", {
        autoplay: {
            delay: 3000, // 设置自动切换的时间间隔为 3000 毫秒（即 3 秒）
            disableOnInteraction: false, // 用户操作后不停止自动切换
        },
        pagination: {
            el: ".swiper-pagination",
        },
        navigation: {
            nextEl: ".swiper-button-next",
            prevEl: ".swiper-button-prev",
        },
    });


    // 移动端菜单切换
    document.getElementById('mobile-menu-button').addEventListener('click', function() {
        const mobileMenu = document.getElementById('mobile-menu');
        mobileMenu.classList.toggle('hidden');
    });

    // 导航栏滚动效果
    window.addEventListener('scroll', function() {
        const header = document.querySelector('header');
        if (window.scrollY > 10) {
            header.classList.add('bg-white/95', 'backdrop-blur-sm');
            header.classList.remove('bg-white');
        } else {
            header.classList.remove('bg-white/95', 'backdrop-blur-sm');
            header.classList.add('bg-white');
        }
    });
</script>
</body>
</html>
